package cn.wolfcode.qo;

import cn.hutool.core.date.DateUtil;
import cn.wolfcode.enums.BusinessReportEnum;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

@Getter
@Setter
public class BusinessReportQueryObject extends QueryObject {
    private String groupType = BusinessReportEnum.CONSUME.getValue();
    private Long businessId;
    private Integer status;
    private Integer ano;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date startDate;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date endDate;

    public Date getEndDate() {
        if (endDate == null) {
            return null;
        }
        return DateUtil.endOfDay(endDate);
    }
}
